;(function($){
	$.fn.timesRoom_oper = function(opts){
		var el = this;
		var opt = {
			title : "预定",
			room : "",
			session : null,
			dataBack : function(){},
			closeBack : function(){},
		}
		var param = $.extend(opt,opts);
		var app = new App(el,param);
	}
	
	var App = function(el,param){
		this.el = el;
		this.param = param;
		this.initHtml();
		this.bindEvent();
	}
	
	App.prototype = {
		bindEvent : function(){
			var el = this.el;
			var param = this.param;
			var t = this;
			
			//关闭
			el.find("#close-dialog,#modalBtnCancel").unbind("click").click(function(){
				t.callBack("close");
			});
			
			//OK
			el.find("#modalBtnOk").unbind("click").click(function(){
			
			});
		},
		callBack : function(name){
			var el = this.el;
			var param = this.param;
			var t = this;
			el.empty();
			el.modal("hide");
			param[name+"Back"]();
		},
		initHtml : function(){
			var el = this.el;
			var param = this.param;
			var t = this;
			
			el.addClass("modal").attr("tabindex","-2").attr("data-backdrop","static");
			var html = 	'<div class="modal-dialog" style="width:800px;>'+
							'<div class="modal-content">'+
								'<div class="modal-header no-padding">'+
									'<div class="table-header">'+
										'<button id="close-dialog" type="button" class="close" data-dismiss="modal" aria-hidden="true" value="HTML">'+
											'<span class="white">&times;</span>'+
										'</button>'+
										'<span id="title-dialog">'+$.i18n.propJsp(param.title)+'</span>'+
									'</div>'+
								'</div>'+
								'<div class="modal-body" style="background:white;">'+
								
									'<form id="frm" class="form-horizontal">'+
										'<div class="widget-box row transparent">'+
											'<div class="widget-header">'+
												'<h5 class="widget-title">'+$.i18n.propJsp(param.title)+":"+param.room+'</h5>'+
											'</div>'+	
											'<div class="widget-body">'+
												
												'<div class="col-sm-6">'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("操作人")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("房号")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("姓名")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("预定")+'</label>'+
														'<div class="col-sm-8">'+
															'<div class="input-group">'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:150px;"/>'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:80px;"/>'+
															'</div>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("抵店")+'</label>'+
														'<div class="col-sm-8">'+
															'<div class="input-group">'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:150px;"/>'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:80px;"/>'+
															'</div>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("离店")+'</label>'+
														'<div class="col-sm-8">'+
															'<div class="input-group">'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:150px;"/>'+
																'<input class="input-sm" type="text" id="gname" name="gname" style="width:80px;"/>'+
															'</div>'+
														'</div>'+
													'</div>'+
													
												'</div>'+
												
												'<div class="col-sm-6">'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("操作人")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("手牌")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("人数")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("身份证")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("早餐")+'</label>'+
														'<div class="col-sm-8">'+
															'<label>'+
																'<input class="ace" type="checkbox"/>'+
																'<span class="lbl">'+$.i18n.propJsp("早餐")+'</span>'+
															'</label>'+
														'</div>'+
													'</div>'+
													'<div class="space-6"></div>'+
													'<div class="form-group">'+
														'<label class="col-sm-4 control-label">'+$.i18n.propJsp("占用时长")+'</label>'+
														'<div class="col-sm-8">'+
															'<input class="input-sm" type="text" id="gname" name="gname"/>'+
														'</div>'+
													'</div>'+
													
												'</div>'+
												
												'<div class="col-sm-12" style="margin-top:8px;">'+
													'<label class="col-sm-2 control-label" style="margin-left:-9px;">'+$.i18n.propJsp("备注")+'</label>'+
													'<div class="col-sm-10">'+
														'<textarea cols="80" rows="5"></textarea>'+
													'</div>'+
												'</div>'+
												
											'</div>'+
										'</div>'+
										
									'</form>'+
									
								'</div>'+
								'<div class="modal-footer">'+
									'<div class="btn-group">'+
										'<button id="modalBtnOk" class="btn btn-sm btn-info">'+
											'<i class="ace-icon fa fa-check"></i>'+
											'OK'+
										'</button>'+
									'</div>'+
									'<div class="btn-group">'+
										'<button id="modalBtnCancel" type="button" class="btn btn-sm btn-default">'+
											'<i class="ace-icon fa fa-times"></i>'+
											$.i18n.propJsp("取消")+
										'</button>'+
									'</div>'+
								'</div>'+
							'</div>'+
						'</div>';
			el.html(html);
		}
	}
	
})(jQuery);